﻿using System.Linq;
using System.Threading.Tasks;
using zhangmenren.IService;
using zhangmenren.Models;
using zhangmenren.Repository;

namespace zhangmenren.Service
{
	public class QiYeService : IQiYeService
	{
		private QiYeRepository qiYeRepository;

		public Task<int> AddAndDel(QiYeShouChangEntity entity)
		{
			if (qiYeRepository.Select(entity).Any())
			{
				return Task.FromResult(qiYeRepository.Del(entity));
			}
			else
			{
				return Task.FromResult(qiYeRepository.Add(entity));
			}
		}
	}
}
